Namespace - LJCDBDataAccess
Parameters
dbRequest - The request object.
Returns
The result XML message.
Syntax
C# |
private DbResult Retrieve(DbRequest dbRequest = null)
|
Retrieves the data row values.
(E)
Remarks
This method is called from the
Execute()
method if the DbRequest.RequestType is "Select".
Example
C# |
private static Person Retrieve(DbDataAccess dbDataAccess
, DbColumns dataDefinition)
{
Person retValue = null;
List<string> columnList = new List<string>();
foreach (DbColumn column in dataDefinition)
{
columnList.Add(column.ColumnName);
}
var dataColumns = DbCommon.QueryColumns(columnList, dataDefinition);
var keyColumns = new DbColumns()
{
{ "Name", (object)"TestName" }
};
dataDefinition.LJCSetExcludeKeyValue("PrincipleFlag");
var queryKeyColumns = DbCommon.QueryKeys(keyColumns, dataDefinition);
DbRequest dbRequest = new DbRequest()
{
Columns = dataColumns,
KeyColumns = queryKeyColumns
QueryType = QueryType.Select.ToString(),
TableName = "PersonTest",
};
DbResult dbResult = dbDataAccess.Execute(dbRequest);
if (dbResult != null)
{
string sqlStatement = dbResult.ExecutedSql;
if (dbResult.DbRecords != null && dbResult.DbRecords.Count > 0)
{
retValue = new Person();
DbCommon.SetObjectValues(dbResult.DbRecords[0], retValue);
}
}
return retValue;
}
|